#ifndef SWITCH_CAMERA_MANIPULATOR
#define SWITCH_CAMERA_MANIPULATOR 1
#include <Define.h>
#include <string>
#include <vector>
#include <osgGA/CameraManipulator>
#include <osg/MatrixTransform>

class OSG_EDITOR_DLL SwitchCameraManipulator : public osgGA::CameraManipulator
{
public:
	SwitchCameraManipulator();

	virtual ~SwitchCameraManipulator();

    bool addCameraManipulator(osg::ref_ptr<osgGA::CameraManipulator> camera_manipulator);
    bool removeCameraManipulator(osg::ref_ptr<osgGA::CameraManipulator> camera_manipulator);
	void selectCameraManipulator(int index_of_vector);

	void selectCameraManipulator(const std::string& name);

	virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);

	virtual void setByMatrix(const osg::Matrixd& matrix);

	virtual void setByInverseMatrix(const osg::Matrixd& matrix);

	virtual osg::Matrixd getMatrix() const;

	virtual osg::Matrixd getInverseMatrix() const;

	osg::ref_ptr<osgGA::CameraManipulator> getCameraManipulatorByName(const std::string& camera_mani_name);
	osg::ref_ptr<osgGA::CameraManipulator> getCameraManipulatorByIndex(int index);
	int getCameraVectorSize();
	std::string getCameraManipulatorName(int index);
	virtual void setHomePosition(const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up, bool autoComputeHomePosition=false);
	virtual void home(double currentTime);

    int getCameraManipulatorIndex(osgGA::CameraManipulator* cameraManiPtr);

protected:

private:
	std::vector<osg::ref_ptr<osgGA::CameraManipulator>> _camera_manipulator_vector;

	osg::ref_ptr<osgGA::CameraManipulator> _current_manipulator;
};


#endif
